import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

let city = '合肥'

if (localStorage.city) {
	city = localStorage.city
}

export default new Vuex.Store({
  state: {
    city
  },
  mutations: {
    changeCity(context, param) {
      context.city = param
      localStorage.city = param
    }
  },
  actions: {
  	changeCityAction(context, param) {
  		context.commit('changeCity', param)
  	}
  }
})
